package com.chaopei.absinter;

/**
 * @Author Corday 天涯
 * @Date 2022/3/8 10:19
 */
public class MyTriangle extends MyAbs {
    //声明三角形的底与高
    private  double bottom;
    private  double height;
    public  MyTriangle(){}

    /**
     *
     * @param weight
     * @param detail
     * @param bottom
     * @param height
     */
    public MyTriangle(double weight, String detail, double bottom, double height) {
        super(weight, detail);
        this.bottom = bottom;
        this.height = height;
    }

    public double getBottom() {
        return bottom;
    }

    public void setBottom(double bottom) {
        this.bottom = bottom;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }

    /**
     *
     * @param refs
     * @return
     */
    @Override
    public double calcArea(double... refs) {
        return refs[0]*refs[1]/2;
    }

    @Override
    public String getDetail() {
        return "三角形面积:"+calcArea(bottom,height);
    }
}
